using System;
using System.Reflection;

using SBPweb.Localization;

namespace SBPweb.Modules.Dependencies
{

	/// <summary>
	/// This class extends VersionDependency class, handles assembly version check
	/// </summary>
	public class AssemblyVersionDependency : VersionDependency<Assembly>
    {

        #region Constructor logic

		/// <summary>
		/// Initializes a new AssemblyVersionDependency instance
		/// </summary>
		/// <param name="value">Version criteria - can be a version mask or range</param>
		/// <param name="asm">Assembly to check</param>
		public AssemblyVersionDependency(string value, Assembly asm)
            : base(value, asm)
        {
        }

        #endregion

		/// <summary>
		/// This method extracts version of the depender assembly
		/// </summary>
		protected override void ExtractVersion()
        {
            string version = ResourceHandler.GetAssemblyCustomAttribute<AssemblyFileVersionAttribute>(Depender) as string;
            pVersion = new System.Version(version);
        }

    }
}